<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Brgy_officials extends CI_Controller{
    public function __construct() {
        parent::__construct();
        $this->load->helper('url');
        $this->load->library('session');
        $this->load->model('Brgy_officials_model');
    }
    public function index(){
        $data['data_coun'] = $this->Brgy_officials_model->get_coun();
        $this->load->view('brgy_officials_main', $data);
        
    }
     public function get_cap($type = '') {
        $this->load->model('Brgy_officials_model');
        $data_cap['ofcl'] = $this->Brgy_officials_model->get_cap($this->input->post('getcap'));
        print json_encode($data_cap);
    }
    public function get_sec($type = ''){
        $this->load->model('Brgy_officials_model');
        $data_sec['ofcl_sec'] = $this->Brgy_officials_model->get_sec($this->input->post('getsec'));
        print json_encode($data_sec);
        
   }
    public function get_tre($type = ''){
        $this->load->model('Brgy_officials_model');
        $data_tre['ofcl_tre'] = $this->Brgy_officials_model->get_tre($this->input->post('gettre'));
        print json_encode($data_tre);
        
   }
   public function edit_ofcl(){
       $data['data_ofcl'] =  $this->Brgy_officials_model->get_official();
       $this->load->view('Brgy_officials_crud', $data);
   }
    public function edit(){
        $result = $this->Brgy_officials_model->edit();
        echo header('Location: ' . base_url() . 'index.php/Brgy_officials');
    }
 
}